<template>
  <el-row
    :gutter="40"
    class="panel-group"
  >
    <el-col
      :xs="12"
      :sm="12"
      :lg="6"
      class="card-panel-col"
      v-for="item in project"
      :key="item.id"
    >
      <div
        class="card-panel"
        @click="handleSetLineChartData(item.id,item.projectName)"
      >
        <div class="card-panel-description">
          <div class="card-panel-text">
            {{ item.projectName }}
          </div>
          <div class="projectDetail">
            <span class="manger">{{ item.createByName}}</span>
            <i class="el-icon-s-custom">{{ item.peopleNum }}</i>
            <i class="el-icon-set-up">{{ item.taskNum }}</i>
          </div>
        </div>
      </div>
    </el-col>
  </el-row>
</template>
<script>
import { Task } from "@/api/task.js";
export default {
  data() {
    return {
      project: [],
      id: "",
    };
  },
  mounted() {
    this.queryTask();
  },
  methods: {
    handleSetLineChartData(id, name) {
      window.localStorage.setItem("projectId", id);
      window.localStorage.setItem("projectName", name);
      this.$router.push({
        name: "taskDetails",
        params: {
          id: id,
          name: name,
        },
      });
    },
    queryTask() {
      Task({}).then((res) => {
        if (res.code == "200") {
          this.project = res.result;
        }
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.panel-group {
  margin-top: 18px;

  .card-panel-col {
    margin-bottom: 32px;
  }

  .card-panel {
    height: 108px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: rgba(199, 237, 233);
    box-shadow: 4px 4px 40px rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.05);

    &:hover {
      .card-panel-icon-wrapper {
        color: #fff;
      }

      .icon-people {
        background: #40c9c6;
      }

      .icon-message {
        background: #36a3f7;
      }

      .icon-money {
        background: #f4516c;
      }

      .icon-shopping {
        background: #34bfa3;
      }
    }

    .icon-people {
      color: #40c9c6;
    }

    .icon-message {
      color: #36a3f7;
    }

    .icon-money {
      color: #f4516c;
    }

    .icon-shopping {
      color: #34bfa3;
    }
    .card-panel-description {
      // float: right;
      font-weight: bold;
      margin: 26px;

      .card-panel-text {
        line-height: 18px;
        height: 40px;
        color: rgba(0, 0, 0, 0.65);
        padding-left: 10px;
        font-size: 20px;
        margin-bottom: 12px;
      }
    }

    .projectDetail {
      display: flex;
      margin-left: 10px;
      margin-right: 5px;
      font-size: 15px;
      .manger {
        flex: 1;
        color: rgb(92, 167, 186);
      }
      .el-icon-s-custom {
        margin-right: 6px;
        color: rgba(92, 167, 186);
      }
      .el-icon-set-up {
        color: rgba(92, 167, 186);
      }
    }
  }
}

@media (max-width: 550px) {
  .card-panel-description {
    display: none;
  }

  .card-panel-icon-wrapper {
    float: none !important;
    width: 100%;
    height: 100%;
    margin: 0 !important;

    .svg-icon {
      display: block;
      margin: 14px auto !important;
      float: none !important;
    }
  }
}
</style>
